<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            height: 3000px;
            width: 3000px;
        }

        div{
            margin-top: 1500px;
            width: 300px;
            height: 300px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div></div>
    <script>
        //事件 ： scroll  属性：scrollTop scrollLeft  两个值都可以读写
        //页面向下滚动距离
        window.addEventListener('scroll',function(){
            console.log(document.documentElement.scrollTop)
        })
        // 将页面向下滚动1200 
        const divv = document.querySelector('div')
        divv.addEventListener('click',function(){
            document.documentElement.scrollTop = 1200
        })
        
        // scroll(x,y) x为左边卷动的距离, y为向下卷动的距离
        // document.documentElement.scrollTo(1200,1200)
        </script>
</body>
</html>